package com.zhou.spring.cloud.balancer.feign.mode;


import com.google.common.collect.Lists;

import java.util.List;

public class SocialInsuranceQueryDtoBuilder {

    /**
     * yyyyMMdd
     */
    private String startDate;

    /**
     * yyyyMMdd
     */
    private String endDate;

    private String index;

    private String accessToken;

    private String name;

    private String idCard;

    public static SocialInsuranceQueryDtoBuilder init() {
        return new SocialInsuranceQueryDtoBuilder();
    }

    public SocialInsuranceQueryDtoBuilder startDate(String startDate) {
        this.startDate = startDate;
        return this;
    }

    public SocialInsuranceQueryDtoBuilder endDate(String endDate) {
        this.endDate = endDate;
        return this;
    }

    public SocialInsuranceQueryDtoBuilder index(String index) {
        this.index = index;
        return this;
    }

    public SocialInsuranceQueryDtoBuilder name(String name) {
        this.name = name;
        return this;
    }

    public SocialInsuranceQueryDtoBuilder idCard(String idCard) {
        this.idCard = idCard;
        return this;
    }

    public SocialInsuranceQueryDtoBuilder accessToken(String accessToken) {
        this.accessToken = accessToken;
        return this;
    }

    public SocialInsuranceQueryDto builder() {
        SocialInsuranceQueryDto queryDto = new SocialInsuranceQueryDto();
        queryDto.setAccessToken(accessToken);
        queryDto.getPage().setIndex(index);
        List<SocialInsuranceQueryDto.Param> params = Lists.newArrayList();
        params.add(new SocialInsuranceQueryDto.Param("AAC002", "=", idCard));
        params.add(new SocialInsuranceQueryDto.Param("AAC003", "=", name));
        params.add(new SocialInsuranceQueryDto.Param("AAE041", ">=", startDate));
        params.add(new SocialInsuranceQueryDto.Param("AAE041", "<=", endDate));
        params.add(new SocialInsuranceQueryDto.Param("AAE140", "=", "110"));
        queryDto.setParams(params.toArray(new SocialInsuranceQueryDto.Param[]{}));
        return queryDto;
    }
}
